/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package de.swta;

import org.apache.wicket.ajax.AjaxRequestTarget;
import org.apache.wicket.ajax.markup.html.AjaxLink;
import org.apache.wicket.ajax.markup.html.form.AjaxButton;
import org.apache.wicket.markup.html.basic.Label;
import org.apache.wicket.markup.html.form.Form;
import org.apache.wicket.markup.html.panel.Panel;

public abstract class SelectContentPanel extends Panel {

    public SelectContentPanel(String id) {
        super(id);

        // Create the form, to use later for the buttons
        Form form = new Form("form");
        add(form);
        add(new Label("textLabel", "HalloTest"));

        // Add some example 'selection' methods, to show as example
        // You can also use a full fledged form, I left that as an
        // exercise for the reader :-)
        add(new AjaxLink("confirmLink"){
            public void onClick(AjaxRequestTarget target) {
                onSelect(target, new String("confirm was clicked"));
            }
        });

        add(new AjaxLink("cancelLink"){
            public void onClick(AjaxRequestTarget target) {
                onCancel(target);
            }
        });
    }

    public void setMessageText(String text) {
        this.remove("textLabel");
        add(new Label("textLabel", text));
    }

    abstract void onCancel(AjaxRequestTarget target);

    abstract void onSelect(AjaxRequestTarget target, String selection);

}

